2026-01-19
Administration
Use Canvas
Lecture Schedule (always in HB)
Labs
2 types of labs:
- Physical help from TA:s
- Completely digital for demoing assignments
There are 3 morning labs at 8 am. These will have some TAs online for people who do not want to wake up in the mornings.
Demos
A poll will be posted on the appropriate lab page before each deadline. Register the day before the demos. About 5 minutes, online during the digital lab-passes. Be there 10 minutes ahead of schedule.
Assignments
Register your group before Friday!
- Trainspotting (Java)
- A-mazed (Java)
- CCHAT (Erlang)
Wednesday Lab
There is a lab on Wednesday:
- Create groups
- Setup the train system
- Experiment with sequential programs
- Only one train
- Start and stop
- Check distances and speed
Code Grader
Using a new system for grading labs in Canvas.
May have issues, please have patience.
Questions
Post your technical questions on the discussion forum.
Administrative/personal issues: pcp-teachers@lists.chalmers.se
DO NOT use Canvas messages.
Learning outcomes
See Learning outcomes on Chalmers website.
Three parts
The course is divided into 3 parts:
Part 1: Classic, shared-memory concurrency in Java:
- Java threads
- Locks, semaphores and monitors
- Fork/join parallelism
Part 2: Message passing concurrency
- Erlang and the actor model
Part 3: Lock-free programming
Tutorials
Java Tutorial
Assumes you know Java, introducing Java concurrency.
21 January
Erlang Tutorial
Does not assume you know Erlang.
13 February
Material
- Lecture slides on Canvas.
- 3 books linked on Canvas.
Exam
Open-book exam:
- up to 2 textbooks
- up to 4 two-sided A4 sheets of notes (printed or handwritten)
- English dictionary
All topics in the lectures can be examined (except guest lectures). See exams previous years on Canvas.
Date: 2026-03-20
Reexam: August/October 2026 (format changed to digital)
Check Canvas for updates.
Computers
Install Java and Erlang/OTP on your computer.
Try out the examples from the lectures.
Lab 1 works best on Linux.
Course Evaluation
Please respond!
Introduction to Concurrent Programming
Amdahl's Law
With
Amdahl's law shows that the impact of introducing parallelism is limited by the fraction
Goals
- Use concurrency to be fast.
- Introduce synchronization to be correct.
- Minimize sequentiality to be efficient.
Processes
Independent unit of execution. A sequential program with an independent:
- identifier
- program counter
- memory space
Runtime/OS schedules and tells processors to work on a process.
States
Ready: ready to be run and allocated
Blocked: waiting for external event
Running: currently running on a processor

Threads
For Java we will use Threads which are lightweight processes. Communicates with other processes with shared (global) memory.
In Java, represented as a class with the following methods:
start() // Start a thread
run() // Entry point for a new thread
join() // Wait for a thread to end
isAlive() // Check if thread is RUNNING
setName()
getName()
getPriority()
Implementation using the Thread class and inheritance
Extend the Thread class and override the run() method. (Javadoc)
Not recommended.
Implementation using Runnable
The Runnable interface (Javadoc) implements just the run() method and a Thread can be created from the runnable.
Runnable myRun = new MyRunnable();
Thread myThread = new Thread(myRun);
myThread.start();
Message passing
In Erlang there is no shared memory, instead messages are sent between processes.